﻿<%@ Page Title="" Language="C#" MasterPageFile="~/RemoteAccess.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Gpf.Whs.YouTubeDownloader.AddIn.Default" %>
<%@ Register Assembly="WSSG.Web" Namespace="Microsoft.WindowsServerSolutions.Web.Controls" TagPrefix="wfxc" %>
<%@ Register src="HelpBlock.ascx" tagname="HelpBlock" tagprefix="uc1" %>

<asp:Content ID="HeaderDefault" ContentPlaceHolderID="head" runat="server">
	<link type="text/css" rel="stylesheet" href="/Remote/BuiltIns/HomePage/Homepage.css" />
	<link type="text/css" rel="stylesheet" href="/Remote/Customization/Product/Homepage/Homepage.css" />
</asp:Content>
<asp:Content ID="ToolStripDefault" ContentPlaceHolderID="ToolStripPanel" runat="server">
</asp:Content>
<asp:Content ID="ContentDefault" ContentPlaceHolderID="PageContent" runat="server">
	<style type="text/css">
	.youTubeDownloaderButton
	{
		background-color:rgb(220,227,168);
		border: 1px solid green;
		color: black;
	}    
	.My-Gadget-Content
	{
		margin-top: 12px; 
		margin-right: 12px; 
		margin-bottom: 0px; 
		margin-left: 12px;  
	}
	.My-Gadget-Content li
	{
		margin-left: -20px;
	}
	tr.Homepage-GadgetTopRow
	{
		cursor:default;  
	}
	.My-Sidebar
	{
		float:right;
		width:300px;    
	}
	</style>

	<uc1:HelpBlock runat="server" />

	<asp:UpdatePanel runat="server" ID="ytdUpt" UpdateMode="Conditional" ChildrenAsTriggers="True">
		<Triggers>
			<asp:PostBackTrigger ControlID="loadFormatsCommand" />
		</Triggers>
		<ContentTemplate>
			<asp:Label runat="server" ID="errorField"></asp:Label>
			<table border="0" cellpadding="3" cellspacing="0">
			<tr>
				<td>YouTube Url:</td>
				<td><asp:TextBox runat="server" ID="videoUrlField"></asp:TextBox></td>
				<td><asp:Button runat="server" ID="loadFormatsCommand" Text="Load formats" CssClass="youTubeDownloaderButton" /></td>
			</tr>
			<tr runat="server" id="titleRow">
				<td valign="top">Title:</td>
				<td><asp:Label runat="server" ID="videoTitleField"></asp:Label></td>
			</tr>
			<tr runat="server" id="libraryRow">
				<td>Library:</td>
				<td><asp:DropDownList runat="server" ID="librariesList" DataTextField="Name" DataValueField="FolderId"></asp:DropDownList></td>
			</tr>
			<tr runat="server" id="formatRow">
				<td>Format:</td>
				<td><asp:DropDownList runat="server" ID="formatsList" DataTextField="Title" DataValueField="Code"></asp:DropDownList></td>
				<td><asp:Button runat="server" ID="downloadCommand" Text="Download" CssClass="youTubeDownloaderButton" /></td>
			</tr>
			</table>
		</ContentTemplate>
	</asp:UpdatePanel>

	<asp:UpdatePanel runat="server" ID="progressPanel" UpdateMode="Conditional" ChildrenAsTriggers="True">
		<Triggers>
			<asp:AsyncPostBackTrigger ControlID="progressTimer" EventName="Tick" />
			<asp:AsyncPostBackTrigger ControlID="downloadProgressRepeater" EventName="ItemCommand" />
		</Triggers>
		<ContentTemplate>
			<asp:Timer runat="server" ID="progressTimer" Interval="3000" Enabled="true"></asp:Timer>
			<asp:Label runat="server" ID="progressErrorField" />
			<asp:Repeater runat="server" ID="downloadProgressRepeater" OnItemCommand="CancelDownloadCommandClick">
				<HeaderTemplate><ul></HeaderTemplate>
				<ItemTemplate>
					<li><%# Eval("Title") %> - <%# Eval("PercentDownloaded") %>% <br />
						<asp:LinkButton ForeColor="Red" runat="server" ID="cancelDownloadCommand" CommandArgument='<%# Eval("Key") %>' Text="Cancel" />
					</li>
				</ItemTemplate>
				<FooterTemplate></ul></FooterTemplate>
			</asp:Repeater>
		</ContentTemplate>
	</asp:UpdatePanel>
</asp:Content>